package managedbean;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;

import dao.BookDao;

import model.Book;


@ManagedBean(name="bestSellerBean")
@SessionScoped
public class BestSellerManagedBean {

	private List<Book> books;
	
	@ManagedProperty(value="#{bookDao}")
	private BookDao bookDao;
	
	public List<Book> getBooks() {
		return books;
	}
	
	public void setBooks(List<Book> books) {
		this.books = books;
	}
	
	public BookDao getBookDao() {
		return bookDao;
	}
	
	public void setBookDao(BookDao bookDao) {
		this.bookDao = bookDao;
	}
	
	@PostConstruct
	public void searchBestSellerboks() {
		setBooks(getBookDao().getBestSellerBooks());
	}
}
